#!/bin/absh

## basic数据入库操作

source ~/.bashrc

## 时间参数
declare -i cur_date
if [[ $# -ne 1 ]];then
        echo "usage:sh run_basicDB.sh 20160601   :date is must!"
        exit 1
else
        cur_date=$(date +"%Y%m%d" -d "$1")
        if [[ $? -ne 0 ]];then
                echo "usage:sh run_basicDB.sh 20160601   :date is invalid!"
        fi
fi
echo "==========sh run_basicDB.sh $cur_date==========="

# 执行入库操作
hdfsPath=/tmp/basic/${cur_date}/2/
localFile=/home/hadoop/udm/data/basic_${cur_date}
hdfs dfs -text $hdfsPath/pa* > $localFile
java -cp udm-1.0-jar-with-dependencies.jar com.baidu.udm.db.LoadIntoMysql --basic $localFile --date $cur_date
